home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Internet Config 1.2 / Internet Config / Goodies / ICReadOnly / ICSpecificOverride.p next >
Encoding:
Text File  |  1995-05-01  |  5.8 KB  |  114 lines  |  [TEXT/PJMM]

  1. ocPtr for each *)
  2. (*     routine that you override or add. *)
  3. (* 11. Write each routine. If you want the component to continue calling *)
  4. (*     through to the captured component for this routine then have your *)
  5. (*     routine return delegateThisCallErr. *)
  6. (* 12. Smirk at the wonders of Component Manager. *)
  7. (* 13. Looking inside ICGenericOverride and frown at the wonders of Component Manager. *)
  8.  
  9. (* Share and Enjoy. *)
  10.  
  11. (* Quinn *)
  12. (* 12 Feb 1995 *)
  13.  
  14. interface
  15.  
  16.     uses
  17.         Components;
  18.  
  19.     const
  20.         kOurComponentManufacturer = 'ICRo';
  21. (* You must set this up appropriately. Things will not be good otherwise. *)
  22.  
  23.         delegateThisCallErr = $81234568;
  24. (* Return this from a component routine if you want the generic override *)
  25. (* component to pass this call through to the captured component. *)
  26.  
  27.     type
  28.         sharedGlobals = record
  29.                 delegate: Component;
  30.                 (* add your own shared globals here *)
  31.             end;
  32.         sharedGlobalsPtr = ^sharedGlobals;
  33.  
  34.         globalsRecord = record
  35.                 self: ComponentInstance;
  36.                 target: ComponentInstance;
  37.                 delegate: ComponentInstance;
  38.                 shared: sharedGlobalsPtr;
  39.                 (* add your own component specific globals here*)
  40.             end;
  41.         globalsPtr = ^globalsRecord;
  42.         globalsHandle = ^globalsPtr;
  43.  
  44. (* Except when otherwise noted the globals handle is *)
  45. (* locked when any of these routines are called. *)
  46.  
  47.     function ICSOInitShared (globals: globalsHandle): ComponentResult;
  48. (* This routine is called to init the shared globals. *)
  49. (* If you return an error then you should make sure your part of *)
  50. (* the shared globals are 'clean'. *)
  51.  
  52.     function ICSOCleanShared (globals: globalsHandle): ComponentResult;
  53. (* This routine is called to clean the shared globals. *)
  54. (* WARNING:  This will never been called if you're using an old version *)
  55. (* of the Component Manager. Workaround: If your specifics only bleeds *)
  56. (* small amounts of memory then don't worry. If your specifics bleeds a *)
  57. (* lot of memory or other resources (such as open files) then refuse to *)
  58. (* install with older Component Managers (I think it was fixed in v2 of the *)
  59. (* manager. *)
  60.  
  61.     function ICSOInitGlobals (globals: globalsHandle): ComponentResult;
  62. (* This routine inits the override specific fields of the component *)
  63. (* specific globals. If it returns an error then the globals must be 'clean'. *)
  64.  
  65.     function ICSOCleanGlobals (globals: globalsHandle): ComponentResult;
  66. (* This routine cleans up the component specific globals, disposing any *)
  67. (* pointers and otherwise releasing any allocated resources. *)
  68.  
  69.     function ICSOCanDo (globals: globalsHandle; selector: integer): ComponentResult;
  70. (* This routine is called in response to a component can do request. *)
  71. (* You should set component result to: *)
  72. (*   -1 if you definitely want to say that the component can't do this *)
  73. (*     0 if you definitely want to say that the component can do this *)
  74. (*     1 if you want to let the target decide *)
  75. (* WARNING: These constants are quite different from the constants *)
  76. (* used by a standard Component Manager CanDo request. *)
  77.  
  78.     function ICSOWhatToOverride (globals: globalsHandle; selector: integer): ProcPtr;
  79. (* Return nil if you do not want to override this what. *)
  80. (* Return a pointer to a procedure with the appropriate signature *)
  81. (* if you do. *)
  82. (* WARNING: globals will not necessarily be locked and may be nil!!! *)
  83.  
  84. implementation
  85.  
  86.     uses
  87.         ICTypes, ICCAPI, ICComponentSelectors;
  88.  
  89.     function ICSOInitShared (globals: globalsHandle): ComponentResult;
  90.     begin
  91.         ICSOInitShared := noErr;
  92.     end; (* ICSOInitShared *)
  93.  
  94.     function ICSOCleanShared (globals: globalsHandle): ComponentResult;
  95.     begin
  96.         ICSOCleanShared := noErr;
  97.     end; (* ICSOCleanShared *)
  98.  
  99.     function ICSOInitGlobals (globals: globalsHandle): ComponentResult;
  100.     begin
  101.         ICSOInitGlobals := noErr;
  102.     end; (* ICSOInitGlobals *)
  103.  
  104.     function ICSOCleanGlobals (globals: globalsHandle): ComponentResult;
  105.     begin
  106.         ICSOCleanGlobals := noErr;
  107.     end; (* ICSOCleanGlobals *)
  108.  
  109.     function ICSOCanDo (globals: globalsHandle; selector: integer): ComponentResult;
  110.     begin
  111.         ICSOCanDo := delegateThisCallErr;
  112.     end; (* ICSOCanDo *)
  113.  
  114.     function RSCGetPref (g